package two_shape;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.shape.Line;
import javafx.stage.Stage;

public class LineExample extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        //实例化Line类
        Line line = new Line();
        //设置line的起始X坐标
        line.setStartX(0);
        //设置line的起始Y坐标
        line.setStartY(0);
        //设置line的结束X坐标
        line.setEndX(100);
        //设置line的结束Y坐标
        line.setEndY(200);

        //创建Group
        Group group = new Group();
        //添加line到group中
        group.getChildren().add(line);
        Scene scene = new Scene(group, 300, 300);

        primaryStage.setScene(scene);
        primaryStage.setTitle("Line Example");
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
